﻿using System.Collections;
using System.Collections.Generic;

namespace Rimifier.Support
{
  public class PawnList : IEnumerable<PawnListItem>, IThingList
  {
    public List<PawnListItem> List { get; private set; }

    public PawnList()
    {
      List = new List<PawnListItem>();
    }

    public void Add(PawnListItem item)
    {
      List.Add(item);
    }

    public IEnumerator<PawnListItem> GetEnumerator()
    {
      return List.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
      return GetEnumerator();
    }

    public IThing GetThingById(string id)
    {
      return GetThingByValue(id);
    }

    public IThing GetThingByValue(string value)
    {
      return List.Find(item => item.ColonistId == value);
    }

    public IThing GetThingByIndex(int index)
    {
      return List[index];
    }

  }

}